{include file='fcworker/fc_head'}
<style type="text/css">
    .controlBox span{
        color: #1c1c1c !important;
        font-size: 12px !important;
        font-weight: bold;
    }
    .contBtn{
        float: left !important;
    }
    .searchBox_append{
        width: 7.14rem !important;
        background-size: 100% 100% !important;
    }
    .searchBox_input1{
        width: 4.4rem !important;
    }
    .searchBox_input_append{
        width: 5.7rem !important;
    }
    .searchBox1 {
        margin-left: .2rem !important;
    }
    .search_btn1{
        width: .9rem !important;
    }
</style>
<a href="javascript:void(0)" class="backTop"><img src="{$_G['URL']['FCWORK_CSS']}images/backtop.png"></a>
<div class="fixTop fixPos">
    <form id="myform" action="/{php echo createMobileUrl('X_otherForm',array('themeid'=>$themeid,'op'=>'display'));}" method="get" style="display: flex">
        <input type="hidden" name="soft" value="{$soft}" />
        {if $worker_list}
        <div  >
            <select onchange="submitForm();" class="form-control" name="select_workerid" style="width: 1.7rem;height: .7rem;margin-left: .1rem;">
                {loop $worker_list $row}
                <option value="{$row['uid']}" {if $select_workerid == $row['uid'] }selected="selected"{/if}>{$row['username']}</option>
                {/loop}
            </select>
        </div>
        {/if}
        <div class="searchBox {if $worker_list}searchBox1{else}searchBox_append{/if}">
            <input type="text" name="searchtxt"  placeholder="请输入关键字" value="{$search_data}" class="{if $worker_list}searchBox_input1{else}searchBox_input_append{/if}">
            <button type="submit" id="search_btn" class="{if $worker_list}search_btn1{/if}">搜索</button>
        </div>
    </form>
</div>




<body>
<div class="container">
    <div class="numPeople">
        <ul>
            <a href="/{php echo createMobileUrl('X_otherForm',array('themeid'=>$themeid,'op'=>'display','searchtxt'=>$search));}"  class="checkBtn1">
                <li>
                    <p {if $op=='display'}style="color:#FCF95F;"{/if}>客资总数</p>
                    <span {if $op=='display'}style="color:#FCF95F;"{/if}>{php echo $total;}</span>
                </li>
            </a>
            <a href="/{php echo createMobileUrl('X_otherForm',array('themeid'=>$themeid,'op'=>'has_flag','searchtxt'=>$search));}"  class="checkBtn1">
                <li>
                    <p {if $op=='has_flag'}style="color:#FCF95F;"{/if}>已追踪</p>
                    <span {if $op=='has_flag'}style="color:#FCF95F;"{/if}>{php echo $has_flag_total;}</span>
                </li>
            </a>
            <a href="/{php echo createMobileUrl('X_otherForm',array('themeid'=>$themeid,'op'=>'no_flag','searchtxt'=>$search));}"  class="checkBtn1">
                <li>
                    <p {if $op=='no_flag'}style="color:#FCF95F;"{/if}>未追踪</p>
                    <span {if $op=='no_flag'}style="color:#FCF95F;"{/if}>{php echo $no_flag_total;}</span>
                </li>
            </a>
        </ul>
    </div>
</div>

<div id="append_list">
    {if $list}
    {loop $list $key $item}
    <div class="peoPle">
        <div class="peopleTime" style="display: flex;flex-direction: row;justify-content: space-between;">
            <div>
                {if $item['order_info']=='未支付'}
                <span style="background: red;color: #ffffff;padding: 3px;border-radius: 3px;">{$item['order_info']}</span>
                {else}
                <span style="background: #07c160;color: #ffffff;padding: 3px;border-radius: 3px;">{$item['order_info']}</span>
                {/if}
                {$item['created_at']}
            </div>
            <div>{$item['workername']}</div>
        </div>
        <div class="peopleInfor">
            <div class="peopleImg">
                <img src="{$item['avatar']}">
                <div class="teamNum">UID:{$item['uid']}</div>
            </div>
            <div class="peopleTxt">
                <h2>{$item['nickname']}</h2>
                <p>姓名：{$item['username']}</p>
<!--                <p>{$item['workername']}</p>-->
            </div>
            <a href="tel:{$item['mobile']}" class="telBtn"></a>
        </div>
        <div class="information">
            {loop $item['moreinfo'] $k $v}
            <p>{$v}</p>
            {/loop}
        </div>
        <div class="controlBox">
            <span class="contBtn">更多信息</span>
            <a href="/{php echo createMobileUrl('main',array('themeid'=>$themeid,'mod'=>'userdata','op'=>'user_trace_list','uid'=>$item['uid']));}" class="checkBtn">追踪</a>
        </div>
    </div>
    {/loop}
    {/if}
</div>
<div class="h110"></div>
{include file='fcworker/fc_foot'}
<input type="hidden" name="page" id="page" value="{$page}">
<input type="hidden" name="op" id="op" value="{$op}">
<input type="hidden" name="hasNext" id="hasNext" value="{$hasNext}">
</body>
<script type="text/javascript">
    function submitForm(){
        var form = document.getElementById("myform");
        form.submit();
    }
    var loadingState= false;
    var hasNext = 1;
    $(window).scroll(function(){
        hasNext = $("#hasNext").val();
        var height = $(window).height();
        var scrollSpace = $(window).scrollTop();
        if(scrollSpace>height){
            $('.backTop').fadeIn();
        }else{
            $('.backTop').fadeOut();
        }
        if (scrollSpace >= $(document).height() -  (height*1.2)){
            if (!loadingState && hasNext==1){
                var page = $("#page").val();
                var op = $("#op").val();
                var next_page = +page+1;
                loadingState = true;
                $("#page").val(next_page);
                layer.msg('加载中', {
                    icon: 16
                    ,shade: 0.01
                });
                var postUrl="/{php echo createMobileUrl('X_otherForm',array('themeid'=>$themeid));}";
                $.ajax({
                    url:postUrl,
                    dataType:'json',
                    method:'post',
                    data: {page:next_page,op:op,op2:''},
                    success:function (e) {
                        let data = e.data;
                        let error = e.error;
                        let msg = e.msg;
                        if (error!=0){
                            layer.msg(msg);
                        }else{
                            if (data.append_html){
                                $("#append_list").append(data.append_html);
                            }
                            layer.closeAll();
                        }
                        loadingState = false;
                        if (data.hasNext){
                            hasNext = 1;
                        }else{
                            hasNext = 0;
                        }
                        $("#hasNext").val(hasNext);
                    },
                    fail:function (err) {
                        console.log(err)
                    }
                });
            }
        }
    })
    $('.backTop').click(function(){
        $('body,html').animate({scrollTop:0},500);
    })
    $(function () {
        $('#append_list').on('click','.contBtn',function () {
            if($(this).hasClass('on')){
                $(this).parent().siblings('.information').removeClass('cur');
                $(this).removeClass('on')
            }else{
                $(this).addClass('on')
                $(this).parent().siblings('.information').addClass('cur');
            }
        });
        $('.numPeople').on('click','.checkBtn1',function (e) {
            var id = this.dataset.id;
            var jump_url ='{php echo "/".createMobileUrl("X_fans",array("themeid"=>$themeid));}'+'&scan='+id;
            self.location.href=jump_url;
        });
    })
</script>

</html>